
//
//  MyCustomViewModel.m
//  didacar
//
//  Created by 度周末网络-王腾 on 16/1/18.
//  Copyright © 2016年 dzmmac. All rights reserved.
//

#import "MyCustomViewModel.h"

@implementation MyCustomViewModel

-(id)init{
    self.myStarts = [[NSMutableArray alloc ] init];
    
    self.mySignUps = [[NSMutableArray alloc ] init];
    
    return [super init];
}

/**
 *  我的定制
 *
 *  @param resultBlock 回调
 */
-(void)loadCustomData:(DealDataResultBlock)resultBlock{
    
    NSMutableDictionary *postData = [[NSMutableDictionary alloc ] init];
    
    [postData setObj:USERINFOManager.getUserInfo.MemberId forKey:@"MemberId"];
    
    WEAKSELF
    [[BaseHttpRequest sharedInstance] sendRequestToPost:MyCustom withData:postData alertMessage:@"" success:^(NSDictionary *dicData) {
        
        NSDictionary *dic = [dicData objectForKey:@"MyCustomizedList"];
        
        for (NSDictionary *subDic in [dic objectForKey:@"1"]) {
            MyCustomModel *customModel = [[MyCustomModel alloc ] initWithDictionary:subDic];
            [weakSelf.myStarts addObject:customModel];
        }
        
        for (NSDictionary *subDic in [dic objectForKey:@"2"]) {
            MyCustomModel *customModel = [[MyCustomModel alloc ] initWithDictionary:subDic];
            [weakSelf.mySignUps addObject:customModel];
        }
        
        resultBlock(1,nil,nil);
        
    } error:^(NSString *errorMsg) {
        resultBlock(0,nil,errorMsg);
    }];
}

@end
